package com.ruan.controller;

import com.ruan.entity.Result;
import com.ruan.service.AddressService;
import com.ruan.service.UserAddressService;
import com.ruan.vo.AddressVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName:UserAddressController
 * @Author:阮昇
 * @Description:
 * @Datetime: 2023/7/3 10:22
 **/
@RestController
@RequestMapping("/address")
public class UserAddressController {

    @Autowired
    private UserAddressService userAddressService;

    @RequestMapping("/getAddressListById/{id}")
    public Result getAddressListById(@PathVariable Integer id){
        return userAddressService.getAddressListById(id);
    }

    @RequestMapping("/deleteAddress/{id}")
    public Result deleteAddress(@PathVariable Integer id){
        return userAddressService.deleteAddress(id);
    }

    @PostMapping("/editAddress")
    public Result editAddress(AddressVo addressVo){
        return userAddressService.editAddress(addressVo);
    }

}
